import { ProForm, ProFormRadio, ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-components"
import { checkDictDataValueUnique } from '@/api/system/dict/data'
import { useDictOptions } from "@/hooks"
const JobForm = () => {
  let { data: statusOptions } = useDictOptions('sys_job_status')
  let { data: jobGroupOptions } = useDictOptions('sys_job_group')
  return <>
    <ProForm.Group rowProps={{
      gutter: 20
    }}>

      <ProForm.Item name='jobId' hidden></ProForm.Item>

      <ProFormText
        colProps={{ lg: 12, md: 12, sm: 24 }}
        name="jobName"
        label="任务名称"
        placeholder="请输入任务名称"
        rules={[{ required: true, message: '请输入任务名称' }]}
      />

      <ProFormSelect
        colProps={{ lg: 12, md: 12, sm: 24 }}
        name="jobGroup"
        label="任务分组"
        placeholder="请选择任务分组"
        options={jobGroupOptions}
      />
      <ProFormText
        colProps={{ lg: 12, md: 12, sm: 24 }}
        name="invokeTarget"
        label="调用方法"
        placeholder="请输入调用方法"
        rules={[{ required: true, message: '请输入调用方法' }]}
      />
      <ProFormText
        colProps={{ lg: 12, md: 12, sm: 24 }}
        name="cronExpression"
        label="cron表达式"
        placeholder="请输入cron表达式"
        rules={[{ required: true, message: '请输入cron表达式' }]}
      />
      <ProFormRadio.Group
        colProps={{ lg: 12, md: 12, sm: 24 }}
        label="是否并发"
        name="concurrent"
        fieldProps={{
          optionType: "button",
          buttonStyle: "solid"
        }}
        options={[
          { value: '0', label: '允许' },
          { value: '1', label: '禁止' }
        ]}
      />
      <ProFormRadio.Group
        colProps={{ lg: 12, md: 12, sm: 24 }}
        label="错误策略"
        name="misfirePolicy"
        fieldProps={{
          optionType: "button",
          buttonStyle: "solid"
        }}
        options={[
          { value: '1', label: '立即执行' },
          { value: '2', label: '执行一次' },
          { value: '3', label: '放弃执行' }
        ]}
      />
      <ProFormRadio.Group
        colProps={{ lg: 12, md: 12, sm: 24 }}
        label="状态"
        name="status"
        options={statusOptions}
      />
    </ProForm.Group>
    <ProFormTextArea
      rows={4}
      name="remark"
      label="备注"
      placeholder="请输入内容"
    />
  </>
}



export default JobForm